-
Notifications
You must be signed in to change notification settings - Fork 8k
Fix GH-21058: error_log() crash on null destination argument. #21064
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
|
||
| case 3: /*save to a file */ | ||
| stream = php_stream_open_wrapper(ZSTR_VAL(opt), "a", REPORT_ERRORS, NULL); | ||
| stream = php_stream_open_wrapper(opt ? ZSTR_VAL(opt) : NULL, "a", REPORT_ERRORS, NULL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is a no-op anyway, then why not check !opt and bail out here? Seems clearer to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it s for php_stream_open_wrapper_ex to throws a ValueError which aligns with previous branches.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. What about a test? ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did, no ? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I hate github mobile
| error_log("test", 3, null); | ||
| } catch (\ValueError $e) { | ||
| echo $e->getMessage(), PHP_EOL; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please close the test
we preserve the lower branches behavior by letting php_stream_open_wrapper_ex handling the null path and propagating the exception. close phpGH-21064
we preserve the lower branches behavior by letting php_stream_open_wrapper_ex handling the null path and propagating the exception.